package com.carrot.newsgallery.config;

import com.carrot.newsgallery.interceptor.LoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class LoginWebConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginInterceptor())
                .addPathPatterns("/**")
                .excludePathPatterns("/favicon.ico", "/swagger-ui.html",
                        "/user/register","/user/login", "/error",
                        "/user/public","/user/public/**",
                        "/newsmain", "/newschild/**",
                        "/newschild","/newschild/**",
                        "/forum", "/comment/public"
//                        , "/newsfavor/**"
                );
    }
}
